from enum import Enum, IntEnum, StrEnum

from app.utils.decorators.enum_description import enum_description


@enum_description(male="男性", female="女性",other="其他")
class GenderEnum(IntEnum):
    """性别枚举"""
    male = 0
    female = 1
    other =2

@enum_description(dir = "目录", menu = "菜单",btn ="按钮")
class MenuEnum(IntEnum):
    """菜单枚举"""
    dir = 0
    menu = 1
    btn = 2

@enum_description(super_admin ="超级管理员",admin = "管理员",member = "会员",user = "用户",tourist = "游客")
class RoleEnum(StrEnum):
    """角色类型枚举"""
    super_admin ="super_admin"
    admin = "admin"
    member = "member"
    user = "user"
    tourist = "tourist"

@enum_description(province ="省份/直辖市/特别行政区",city = "城市",country = "县/区",town = "镇/乡/街道",village = "村/社区")
class RegionTypeEnum(IntEnum):
    """区域类型枚举"""
    province =0
    city = 1
    country = 2
    town = 3
    village = 4

@enum_description(mobile ="手机",tablet = "平板",pc = "电脑",bot = "机器人",other = "其他")
class DeviceType(IntEnum):
    """设备类型"""
    mobile =0
    tablet = 1
    pc = 2
    bot = 3
    other = 4


@enum_description(phone_number ="手机号",email = "邮箱",username = "用户名",wechat="微信登录")
class LoginAccountType(StrEnum):
    """登录账户类型"""
    phone_number = "phone_number"
    email = "email"
    username = "username"
    wechat = "wechat"


class CacheKeyPrefixConst(str, Enum):
    """缓存键前缀"""
    # Token版本
    TOKEN_VERSION_CACHE_PREFIX="TOKEN_VERSION_CACHE_PREFIX"
    # 刷新Token
    REFRESH_TOKEN_CACHE_PREFIX="REFRESH_TOKEN_CACHE_PREFIX"
    # 权限菜单
    AUTH_MENUS_CACHE_PREFIX = "AUTH_MENUS_CACHE_PREFIX"
    # 菜单权限键
    AUTH_MENUS_KEYS_CACHE_PREFIX = "AUTH_MENUS_KEYS_CACHE_PREFIX"
    # 权限API
    AUTH_APIS_CACHE_PREFIX = "AUTH_APIS_CACHE_PREFIX"
    # API权限键
    AUTH_APIS_KEYS_CACHE_PREFIX = "AUTH_APIS_KEYS_CACHE_PREFIX"

class AuthScopePrefixConst(str, Enum):
    """权限作用域前缀"""
    USER_SCOPE_PREFIX="sys:auth:user:",
    WECHAT_USER_SCOPE_PREFIX="sys:auth:wechat_user:",
    ROLE_SCOPE_PREFIX="sys:auth:role:",
    MENU_SCOPE_PREFIX="sys:auth:menu:",

    DEVICE_SCOPE_PREFIX="sys:set:device:",
    REGION_SCOPE_PREFIX="sys:set:region:",
    FILE_SCOPE_PREFIX="sys:set:file:",
    DICT_SCOPE_PREFIX="sys:set:dict:",
    DICT_TYPE_SCOPE_PREFIX="sys:set:dict_type:",
    API_SCOPE_PREFIX="sys:set:api:",

    OPERATION_LOG_SCOPE_PREFIX="sys:log:operation_log:",
    LOGIN_LOG_SCOPE_PREFIX="sys:log:login_log:",